﻿CREATE FUNCTION QIC.InterfaceTokenDefine(@Token QIC.TokenTable READONLY, @ObjectId INT)
RETURNS VARCHAR(MAX)
AS
BEGIN

	DECLARE @Parameters VARCHAR(MAX)

	SET @Parameters = ''

	SELECT @Parameters += QIC.TokenDefine(PropertyName, UserTypeId, Precision, Scale, MaxLength, IsOutPut, IsReadOnly) + ', '
	FROM @Token 
	WHERE ObjectId = @ObjectId
	and PropertyId > 0
	ORDER BY Id

	IF @Parameters <> '' SET @Parameters = LEFT(@Parameters,DATALENGTH(@Parameters) - 2)

	RETURN @Parameters
END
